﻿<!doctype html>
<html>
<head>
    <title>微街秀</title>
    <meta name='keywords' content='微街秀,网络营销,商汇通,网络推广,移动推广,微信推广,移动搜索推广,上海企动,企动,企动信息' />
    <meta name='description' content='微街秀是企动推出的微媒体广告工具，帮助广大微商快速、简单实现在微媒体上的自我宣传推广。' />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/css.css?25" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <style type="text/css">
        .fixedHiden
        {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: black;
            opacity: 0.3;
            z-index: 99;
            display: none;
        }
        .wrap_detail
        {
            border: 1px solid rgba(0,0,0,.2);
            margin: 10px 15px 0 15px;
            background-color: #F9F9FA;
            font-size: 14px;
            line-height: 24px;
            -webkit-border-radius: 5px;
            border-radius: 5px;
            box-shadow: 0 1px 1px #f6f6f6;
            padding: 15px;
            color: #333;
        }
        #wap{ margin-top:0px;}
    </style>
</head>
<body>
    <a id="bodytop" href="#top"></a>

    <div id="wap">
        <div class="search">
            <div class="Query">
                <input type="text" class="Stext" id="Stext" placeholder="输入关键词或粘贴文章链接转发" />
                <div class="searchico" id="searchico">
                    <img src="img/2.png" />
                </div>
            </div>
        </div>
        <div id="ws_tg">
        </div>
    </div>
    <!--红包-->
    <div id="redshow" style="position: fixed; background: #DA3931; width: 240px; top: 100px;
        display: none; left: 50%; z-index: 999; border-radius: 5px; padding-bottom: 100px;
        margin-left: -120px;">
        <div style="background: #B22C23; width: 100%; height: 100px; border-radius: 5px;">
            <span style="font-size: 20px; float: right; margin: 8px;" id="close">×</span>
            <div style="color: white; position: absolute; top: 90px; left: 50%; width: 200px;
                margin-left: -100px; text-align: center;" class="Titletxt">
            </div>
        </div>
        <div style="background: #B22C23; width: 100%; height: 120px; border-bottom-left-radius: 120px;
            border-bottom-right-radius: 120px;">
        </div>
        <div style="position: absolute; top: 166px; left: 50%; margin-left: -35px;" class="Rob">
            <img src="img/Makeimg/22.png" id="Getimg" style="position: absolute; height: 80px;
                top: 0;">
        </div>
    </div>
    <div class="fixedHiden" style="opacity: 1;">
    </div>
    <input type="hidden" id="advrtid" value="" /> 
</body>
<script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/ajax-data.js" type="text/javascript"></script>
<script src="js/base.js?25" type="text/javascript"></script>
<script>
    var listid = "";
    var arrlistid = "";
    var num = 0;
    var page = 1;
    var keyword = ""; //关键词
    var hannelid = ""; //频道id
    var authid = ""; //作者id
    var pagecount = "0";
    $(document).ready(function () {
        try {
            hannelid = getQueryString("channel_id");
            listid = getCookie("chanid");
            arrlistid = listid.split(',');
        }
        catch (e) { }

        load(keyword, page); //加载列表
        loadShared(); //加载红包
        
        $("#Getimg").bind("click", qiang);
        $("#close").click(function () { $(".fixedHiden").css("display", "none"); $("#redshow").css("display", "none"); });
        $("#searchico").click(function () { srachkeyword() });

        $(window).bind("scroll", function () {
            //当滚动条滚动时
            var scollTop = $(this).scrollTop() + $(this).height();
            var scollH = $(document).height();
            if (scollH - scollTop < 100) {
                if (wait.isShow) { return; } //如果正在加载，则返回  
                page++;
                load(keyword, page);
            }
            return false;
        });
    });
    function load(keyword, pages) {
        if (pagecount == "1") { return; }
        ajax.getAjax("Ajax/Article.ashx?GetList", "channel_id=" + hannelid + "&author_id=" + authid + "&key_word=" + keyword + "&page_index=" + pages + "&is_recommend=1", function (data) {
            if (data.code == "4") { Alert("没有相关文章"); pagecount = "1"; return; }
            if (data.item.pageCount < pages) {
                if (pagecount == "0")
                    Alert('到底了！');
                pagecount = "1"; return;
            }
            $(data.item.table).each(function () {
                num++;
                //默认图片
                var logoimg = this.logo == null ? "img/30.png" : this.logo;
                var titles = this.title;
                if (titles.length > 11)
                    titles = titles.substr(0, 11) + "...";
                var imgrob = "<img class=\"rob\" src=\"img/Makeimg/newicon/hongbao.gif\" >";
                $("#ws_tg").append("<div class=\"centenlist\"><div class=\"centenimg\"><img src=\"" + logoimg + "\" /> </div> <div class=\"cententxt\"  onclick=\"alick('" + this.id + "')\"><div id='t" + this.id + "' class='cententitlte'>" + titles + "</div><div class=\"centenTime\">" + this.date.substr(0, 10) + "<div class=\"centenflow\"><img src=\"img/flow.jpg\" /> " + this.click + "</div></div></div></div>");
            });
        });
    }
    function srachkeyword() {
        $("#ws_tg").html("");
        pagecount = "0";
        var url = $("#Stext").val();


        if (CheckUrl(url)) {
            if (url.indexOf('http') == -1) {
                url = "http://" + url;
            }

            if (url.indexOf(window.location.host) != -1) {
                toast.show("不允许分享内部网页");
                return;
            }

            if (url.indexOf("weixin.qq.com") > -1)
                url = url.replace("#wechat_redirect", "");  //处理微信链接不显示广告位

            window.location.href = "url-edit.html?url=" + encodeURIComponent(url);
        }
        else {
            page = 1;
            load(url, page);
        }
    }

    //加载红包
    function loadShared() {
        //客户端打开才显示红包
        var param = "";
        var arr = getCookie('area')
        if (arr != null && arr != '') {
            arr = arr.split(',');
            for (var i = 0; i < arr.length; i++) {
                if (i > 2) break;
                param += '&area' + (i + 1) + '=' + arr[i];
            }
        }
        ajax.getAjax("Ajax/fc_article.ashx?getlist_top", param, function (data) {
            var html = "";
            $(data.item.table).each(function () {
                var logoimg = this.logo == null ? "img/30.png" : this.logo;
                var titles = this.title;
                if (titles.length > 11)
                    titles = titles.substr(0, 11) + "...";
                var imgrob = "<img class=\"rob\" src=\"img/Makeimg/newicon/hongbao.gif\" >";
                html += "<div class=\"centenlist\"><div class=\"centenimg\"><img src=\"" + logoimg + "\" /> </div> <div class=\"cententxt\"  onclick=\"hongbao(" + this.id + ")\"> " + imgrob + "<div id='title" + this.id + "' class='cententitlte'>" + titles + "</div><div class=\"centenTime\">" + this.date.substr(0, 10) + "<div class=\"centenflow\" style='text-align: center'>剩余:" + this.lock + "</div></div></div></div>";
            });
            if (html.length > 0) {
                $("#ws_tg").before(html);
                $("#tab3").append("<div class=\"newRed\"></div>");
            }
        });
    }

    //红包点击
    function hongbao(id) {
        if (navigator.userAgent.indexOf("wjx") == -1) {
            if (getCookie("userid") == null || getCookie("userid") == "") {
                window.location.href = 'login.html?a=' + getQueryString("a");
                return;
            }
            //提示下载APP打开
            $("#bodytop").click();
            $(".wrap_detail").css("margin-left", parseInt($("#wap").css("width")) / 2 - 120);
            $(".wrap_detail").css("display", "");
            return;
        }


        //新的分享
        $("#redshow").css("display", "block");
        $(".fixedHiden").css("display", "block");
        $(".Titletxt").html($("#title" + id).text());
        $("#advrtid").val(id);
    }

    var q_state = false;
    function qiang() {
        var article_id = $("#advrtid").val();
        if (article_id == "") {
            Alert("参数错误,抢红包失败!");
            return;
        }
        if (!checkHB(article_id)) {
            Alert("一台手机不能重复抢红包!");
            return;
        }
        if (q_state) {
            Alert("请稍等...");
            return;
        }
        ajax.getAjax("ajax/fc_shared_money.ashx?qiang", "&article_id=" + article_id, function (data) {
            q_state = false;
            if (data.code == 0) {
                $("#Getimg").bind("click", function () { Alert("正在跳转请稍等...") });
                window.location.href = "fc_detail.aspx?article_id=" + article_id + "&money_id=" + data.item;
            }
            Alert(data.msg);
        });
    }

    function alick(id) {
        //window.location.href = 'to_detail.aspx?article_id=' + id;

        var param = { url: wjx_domain + '/client/to_detail.aspx?article_id=' + id, title: "这里是标题", hasTop: true, hasCopy: true, hasShare: true };

        var p = JSON.stringify(param);
        //alert(p);
        window.location.href = "callback://openURL?" + p;
    }
</script>
</html>
